#include "string.h"


void Test_string_1()
{
	ssy::string s1("hello xiyou");
	//const ssy::string s2("hello ssy");

	cout << s1._str << endl;
	//cout << s2._str << endl;

	char* it = s1.begin();
	while (it != s1.end())
	{
		cout << *it << ' ';
		it++;
	}

	cout << endl << "auto:";

	for (auto ch : s1)
	{
		cout << ch << ' ';

	}
	 

	cout << s1._str << endl;

}

void Test_string_2()
{
	ssy::string s1 = "hello";
	s1.push_back(' ');
	s1.append("ssy");
	s1 += ' ';
	s1 += "xxxxxxxxxxxxyf";
	s1.insert(5, 10,'#');
	cout << s1._str << endl;
	cout << s1._size << endl;
	s1.erase(5);

	cout << s1._str << endl;

	cout << s1._size << endl;
	cout << s1._capacity << endl;

}

void Test_string_3()
{
	ssy::string s1("hello ssy");
	s1 += "#######aaaaaaaaaaaaaaaaaa";
	//ssy::string s2 = s1.substr();
	size_t pos = s1.find("ssy");
	ssy::string s2 = s1.substr(pos+3);
	cout << s2._str << endl;
}


int main()
{
	//Test_string_1();
	Test_string_3();
	return 0;
}